

from selenium import webdriver
import time
from selenium.webdriver.common.by import By

# 指明 驱动路径
server = webdriver.ChromeService('E:\chromedriver-win64\chromedriver.exe')
# service = webdriver.ChromeService(executable_path="E:\\chromedriver.exe")
# 得到浏览器实例
driver = webdriver.Chrome(service=server)

# 打开页面
driver.get("https://www.baidu.com/")

# 找到元素
input_ele = driver.find_element(By.ID, 'chat-textarea')
# 输入内容
input_ele.clear()
input_ele.send_keys("你好呀")
time.sleep(1)

# 点击按钮
submit_ele = driver.find_element(By.ID, 'chat-submit-button')
submit_ele.click()

time.sleep(5)
# 退出浏览器
driver.quit()